package com.qianfeng.zhangwei.volley.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.NetworkImageView;
import com.qianfeng.zhangwei.volley.utils.AppImageCache;
import com.qianfeng.zhangwei.volley.R;

import java.util.List;

/**
 * @说 明：
 * @项目名称：Sz1504Adv
 * @包 名： com.qianfeng.zhangwei.volley.adapter
 * @类 名： Test
 * @创 建人： zhangwei
 * @创建时间：2015-08-03 11:12
 * @版 本：v1.0
 * @修 改人：
 * @修改时间：
 * @修改备注：
 */
public class TestAdapter extends BaseAdapter {
    private List<String> list;
    private ImageLoader imageLoader;
    private LayoutInflater inflater;

    public TestAdapter(List<String> list, Context context, RequestQueue queue) {
        this.list = list;
        imageLoader = new ImageLoader(queue, AppImageCache.getAppImageCache());
        inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return 0;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder vh = null;
        if (convertView == null) {
//            convertView =inflater.inflate()
            vh = new ViewHolder(convertView);
            convertView.setTag(vh);
        } else {
            vh = (ViewHolder) convertView.getTag();
        }

        vh.img.setDefaultImageResId(R.mipmap.ic_launcher);
        vh.img.setErrorImageResId(R.mipmap.ic_launcher);
        vh.img.setImageUrl(list.get(position), imageLoader);
        return convertView;
    }

    private class ViewHolder {
        private NetworkImageView img;

        public ViewHolder(View convertView) {
//            this.img = convertView.findViewById(R);
        }
    }


}
